<?php
/**
 * 处理所有小工具
 *
 * WP widgets must be unregistered
 * one widgets must be registered in their place
 * All widget areas are loaded and registered with WP
 *
 * Use register_sidebar() to create custom widget areas
 * @链接 http://codex.wordpress.org/WordPress_Widgets_Api/register_sidebar
 *
 * @package one
 * @subpackage Widgets
 */

/*
* Register major widget areas
*/
register_sidebar( array( 'name' => __('top', 'one'), 'id' => 'top', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
register_sidebar( array( 'name' => __('left', 'one'), 'id' => 'left', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
register_sidebar( array( 'name' => __('right', 'one'), 'id' => 'right', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
register_sidebar( array( 'name' => __('down', 'one'), 'id' => 'down', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );

/*
* Register utility widget areas
*/
register_sidebar( array( 'name' => __('Utility: Before Content', 'one'), 'id' => 'utilitybeforecontent', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
register_sidebar( array( 'name' => __('Utility: After Content', 'one'), 'id' => 'utilityaftercontent', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
register_sidebar( array( 'name' => __('Utility: After Single', 'one'), 'id' => 'utilityaftersingle', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
register_sidebar( array( 'name' => __('Utility: After Page', 'one'), 'id' => 'utilityafterpage', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
register_sidebar( array( 'name' => __('Utility: Widgets Template', 'one'), 'id' => 'utilitywidgetstemplate', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );

/**
 * @since 1.0.0
 */function one_get_widget_top() {
if ( is_dynamic_sidebar( __('top', 'one') ) ) : ?>

	<div id="widget-top" class="aside">
	<div id="digushow" class="widget widget_digushow widget-widget_digushow">
	<h3 class="widget-title">嘀咕嘀咕</h3>
	<div id="diguShow">正在加载嘀咕...</div>
	</div>
<!-- posts -->
<?php
if (is_single() || is_page()) {?> 
<div id="Recent_Posts" class="widget widget_Recent_Posts widget-widget_Recent_Posts"><?php
$posts_widget_title =_e('<h3 class="widget-title">最新日志</h3>','philna');
} else {
?><div id="Random_Posts" class="widget widget_Random_Posts widget-Random_Posts"><?php
$posts_widget_title =_e('<h3 class="widget-title">随机推荐</h3>','philna');
}
?>
<?php echo $posts_widget_title; ?>
<ul>
<?php
if (is_single() || is_page()) {
	get_recent_posts();
} else {
	random_posts(); 
}
?>
</ul>
</div>

		<?php one_widget_before_top(); // 钩子
		
		dynamic_sidebar( __('top', 'one') ); 

		one_widget_after_top(); // 钩子?>

	</div>

<?php endif;

}function one_get_widget_down() {
if ( is_dynamic_sidebar( __('down', 'one') ) ) : ?>

	<div id="widget-down" class="aside">

		<?php one_widget_before_down(); // 钩子
		
		dynamic_sidebar( __('down', 'one') ); 

		one_widget_after_down(); // 钩子?>

	</div>

<?php endif;

}

function one_get_widget_left() {
if ( is_dynamic_sidebar( __('left', 'one') ) ) : ?>

	<div id="widget-left" class="aside">

		<?php one_widget_before_left(); // 钩子
		
		dynamic_sidebar( __('left', 'one') ); 

		one_widget_after_left(); // 钩子?>

	</div>

<?php endif;

}function one_get_widget_right() {
if ( is_dynamic_sidebar( __('right', 'one') ) ) : ?>

	<div id="widget-right" class="aside">

		<?php one_widget_before_right(); // 钩子
		
		dynamic_sidebar( __('right', 'one') ); 

		one_widget_after_right(); // 钩子?>

	</div>

<?php endif;} 

function one_get_widget_gfc() {?>


<?php
}

?>